/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



package fmon;

//~--- JDK imports ------------------------------------------------------------

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

import java.io.Serializable;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author jio
 */
@Entity @Table(
    name    = "FILEINFO",
    catalog = "",
    schema  = "ROOT"
)
@NamedQueries( {
    @NamedQuery(name = "Fileinfo.findAll", query = "SELECT f FROM Fileinfo f") ,
    @NamedQuery(name = "Fileinfo.findByFileid", query = "SELECT f FROM Fileinfo f WHERE f.fileid = :fileid") ,
    @NamedQuery(name = "Fileinfo.findByLocation", query = "SELECT f FROM Fileinfo f WHERE f.location = :location") ,
    @NamedQuery(name = "Fileinfo.findByFiletimestamp",
                query = "SELECT f FROM Fileinfo f WHERE f.filetimestamp = :filetimestamp") ,
    @NamedQuery(name = "Fileinfo.findByName", query = "SELECT f FROM Fileinfo f WHERE f.name = :name") ,
    @NamedQuery(name = "Fileinfo.findByMd5", query = "SELECT f FROM Fileinfo f WHERE f.md5 = :md5")
})
public class Fileinfo implements Serializable {
    private static final long     serialVersionUID = 1L;
    @Transient
    private PropertyChangeSupport changeSupport    = new PropertyChangeSupport(this);
    @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "FILEID")
    private Long                  fileid;
    @Column(name = "FILETIMESTAMP")
    @Temporal(TemporalType.TIMESTAMP)
    private Date                  filetimestamp;
    @Column(name = "LOCATION")
    private String                location;
    @Column(name = "MD5")
    private String                md5;
    @Column(name = "NAME")
    private String                name;

    public Fileinfo() {}

    public Fileinfo(Long fileid) {
        this.fileid = fileid;
    }

    public Long getFileid() {
        return fileid;
    }

    public void setFileid(Long fileid) {
        Long oldFileid = this.fileid;

        this.fileid = fileid;
        changeSupport.firePropertyChange("fileid", oldFileid, fileid);
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        String oldLocation = this.location;

        this.location = location;
        changeSupport.firePropertyChange("location", oldLocation, location);
    }

    public Date getFiletimestamp() {
        return filetimestamp;
    }

    public void setFiletimestamp(Date filetimestamp) {
        Date oldFiletimestamp = this.filetimestamp;

        this.filetimestamp = filetimestamp;
        changeSupport.firePropertyChange("filetimestamp", oldFiletimestamp, filetimestamp);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        String oldName = this.name;

        this.name = name;
        changeSupport.firePropertyChange("name", oldName, name);
    }

    public String getMd5() {
        return md5;
    }

    public void setMd5(String md5) {
        String oldMd5 = this.md5;

        this.md5 = md5;
        changeSupport.firePropertyChange("md5", oldMd5, md5);
    }

    @Override
    public int hashCode() {
        int hash = 0;

        hash += ((fileid != null)
                 ? fileid.hashCode()
                 : 0);

        return hash;
    }

    @Override
    public boolean equals(Object object) {

        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Fileinfo)) {
            return false;
        }

        Fileinfo other = (Fileinfo) object;

        if (((this.fileid == null) && (other.fileid != null))
                || ((this.fileid != null) &&!this.fileid.equals(other.fileid))) {
            return false;
        }

        return true;
    }

    @Override
    public String toString() {
        return "fmon.Fileinfo[fileid=" + fileid + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
